import os
import sys

def setSysPath():
    """
    Add lib as primary libraries directory
    """
    c = os.path.abspath(os.path.dirname(__file__))
    add = [
        ['lib'],
    ]
    for item in add:
        p = os.path.join(c, *item)
        if not p in sys.path:
            sys.path[1:1] = [p]
    remove = ['django', 'jinja2', 'simplejson']
    # Remove unwanted paths
    for item in sys.path:
        for r in remove:
            if item.find(r) > 0:
                sys.path.remove(item)

setSysPath()
